package net.sky.oa.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name = "DOC_FOLDER")//文件夹表
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class DocFolder implements java.io.Serializable {
	private static final long serialVersionUID =-2921966792923656664L;
	
	private Long id;//文件夹ID
	private String folderName;
	private Long parentId; //上级文件夹
	private String path; //目录层次
	private Integer type; //类型: 1、公共文件夹;2、部门文件夹 3、个人文件夹
	
	private SysDept dept;  //所属部门
	
	private SysEmployee user; //创建用户(所属用户)
	
	
	public DocFolder() {}
	/**
	 * @param id
	 * @param folderName
	 * @param parentId
	 * @param type
	 */
	public DocFolder(Long id, String folderName, Long parentId, Integer type) {
		super();
		this.id = id;
		this.folderName = folderName;
		this.parentId = parentId;
		this.type = type;
	}
	@Id
	@Column(name = "ID", unique = true, nullable = false)
	@SequenceGenerator(name="SQ_DOCFOLDER_ID",sequenceName="SQ_DOCFOLDER_ID",allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SQ_DOCFOLDER_ID")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@Column(name="FOLDER_NAME",length=60)
	public String getFolderName() {
		return folderName;
	}
	public void setFolderName(String folderName) {
		this.folderName = folderName;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "DEPT_ID")
	public SysDept getDept() {
		return dept;
	}
	public void setDept(SysDept dept) {
		this.dept = dept;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "USER_ID")
	public SysEmployee getUser() {
		return user;
	}
	public void setUser(SysEmployee user) {
		this.user = user;
	}
	@Column(name = "PARENT_ID", length = 19)
	public Long getParentId() {
		return parentId;
	}
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}
	@Column(name = "PATH", length = 128)
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	@Column(name = "TYPE", precision = 2, scale = 0)
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	
	
	
}
